<?xml version="1.0"?>
<!--
****************************************************************************
Ident: Portbase port community system
Copyright: (c) Portbase bv All Rights Reserved.
****************************************************************************
Portbase bv              *  No part of this file may be reproduced or
                         *  transmitted in any form or by any means,
Blaak 16           		 *  electronic or mechanical, or otherwise,
3011 TA Rotterdam        *  without prior written permission of the
The Netherlands          *  copyright holder.
****************************************************************************
Author: R. van der Hoeven
Email: r.vander.hoeven@portbase.com
$Id$ 
-->
<!--
Date		Version		Author				Changelog
05-01-2015	1.0		r.vander.hoeven			Initial version
07-01-2019	201901		t.de.groot			Message updated for non-container equipments for ferry transport (equipment number max. 17 characters)
04-04-2019	201907		r.vander.linden			Maximum number of equipments expanded to 300
07-03-2022	202203		w.hooft				Status 4 removed, as manifest information is  no longer available in MED. 
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xsd:annotation>
		<xsd:documentation>Description: Document structure for the M115 Notification Export shipment status message (xml-out)</xsd:documentation>
	</xsd:annotation>
	<xsd:element name="StandardBusinessDocument">
		<xsd:annotation>
			<xsd:documentation>interchange wrapper</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="StandardBusinessDocumentHeader"/>
				<xsd:element ref="documentContent" maxOccurs="unbounded"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="exportShipment">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="customsDocument" minOccurs="1">
					<xsd:complexType>
						<xsd:sequence>
							<xsd:element name="documentType">
								<xsd:annotation>
									<xsd:documentation>The customs document type, coded.</xsd:documentation>
									<xsd:documentation>Causes error B39 in Functional acknowledgment (M116) when document type is invalid.</xsd:documentation>
								</xsd:annotation>
								<xsd:simpleType>
									<xsd:restriction base="xsd:string">
										<xsd:maxLength value="5"/>
									</xsd:restriction>
								</xsd:simpleType>
							</xsd:element>
							<xsd:element name="documentNumber">
								<xsd:annotation>
									<xsd:documentation>The unique customs document number.</xsd:documentation>
									<xsd:documentation>Causes error C39 in Functional acknowledgment (M116) when an invalid document number (MRN) is used.</xsd:documentation>
									<xsd:documentation>Causes error D09 in Functional acknowledgment when an invalid MRN in combination with the Document Type is used (Country specific MRN /Doctype validation)</xsd:documentation>
								</xsd:annotation>
								<xsd:simpleType>
									<xsd:restriction base="xsd:string">
										<xsd:maxLength value="27"/>
									</xsd:restriction>
								</xsd:simpleType>
							</xsd:element>
						</xsd:sequence>
					</xsd:complexType>
				</xsd:element>
				<xsd:element name="equipment" maxOccurs="300" minOccurs="0">
					<xsd:annotation>
						<xsd:documentation>The transport equipment that carries – a part of – the export shipment.</xsd:documentation>
						<xsd:documentation>In case of an ‘original’ or ‘replace’ message at least one transport equipment is mandatory; in case of an ‘deletion’ message no transport equipment is mandatory.</xsd:documentation>
						<xsd:documentation>In case of a ‘replace’ message all the transport equipments of the shipment have to be mentioned again.</xsd:documentation>
						<xsd:documentation>Causes error C05 in Functional acknowledgment (M116) when equipment not available.</xsd:documentation>
					</xsd:annotation>
					<xsd:complexType>
						<xsd:sequence>
							<xsd:element name="equipmentNumber">
								<xsd:annotation>
									<xsd:documentation>Unique number of the transport equipment of the export shipment.</xsd:documentation>
									<xsd:documentation>Note: Only numbers and alphabetical capital letters, without any spaces and dashes, are allowed.</xsd:documentation>
								</xsd:annotation>
								<xsd:simpleType>
									<xsd:restriction base="xsd:string">
										<xsd:maxLength value="17"/>
									</xsd:restriction>
								</xsd:simpleType>
							</xsd:element>
							<xsd:element name="bookingReferenceNumber">
								<xsd:annotation>
									<xsd:documentation>The booking reference number of the transport equipment for the export shipment.</xsd:documentation>
								</xsd:annotation>
								<xsd:simpleType>
									<xsd:restriction base="xsd:string">
										<xsd:maxLength value="35"/>
									</xsd:restriction>
								</xsd:simpleType>
							</xsd:element>
							<xsd:element name="groupageIndicator">
								<xsd:annotation>
									<xsd:documentation>An indication whether the transport equipment contains more than one export shipment (TRUE) or not (FALSE).</xsd:documentation>
								</xsd:annotation>
								<xsd:simpleType>
									<xsd:restriction base="xsd:boolean"/>
								</xsd:simpleType>
							</xsd:element>
							<xsd:element name="bookingKnownIndicator" minOccurs="0">
								<xsd:annotation>
									<xsd:documentation>An Indication whether the order acceptance number is known (TRUE) or not known (FALSE).</xsd:documentation>
									<xsd:documentation>Used when statusCode of customsStatus equals "0".</xsd:documentation>
								</xsd:annotation>
								<xsd:simpleType>
									<xsd:restriction base="xsd:boolean"/>
								</xsd:simpleType>
							</xsd:element>
						</xsd:sequence>
					</xsd:complexType>
				</xsd:element>
				<xsd:element name="customsStatus">
					<xsd:complexType>
						<xsd:sequence>
							<xsd:element name="statusCode">
								<xsd:annotation>
									<xsd:documentation>The status of an export shipment, coded.</xsd:documentation>
									<xsd:documentation>Allowed values: 
"0"	Export shipment not (completely) arrived
"1"	Arrival at exit message accepted by Customs
"2"	Control notification for export shipment received from Customs
"3"	Release notification for export shipment received from Customs
"5"	Diversion reject notification received from Customs
</xsd:documentation>
								</xsd:annotation>
								<xsd:simpleType>
									<xsd:restriction base="xsd:integer">
										<xsd:enumeration value="0"/>
										<xsd:enumeration value="1"/>
										<xsd:enumeration value="2"/>
										<xsd:enumeration value="3"/>
										<xsd:enumeration value="5"/>
									</xsd:restriction>
								</xsd:simpleType>
							</xsd:element>
							<xsd:element name="statusDescription">
								<xsd:annotation>
									<xsd:documentation>Description of the status code.</xsd:documentation>
									<xsd:documentation>Note: See documentation above for the descriptions.</xsd:documentation>
								</xsd:annotation>
								<xsd:simpleType>
									<xsd:restriction base="xsd:string">
										<xsd:maxLength value="70"/>
									</xsd:restriction>
								</xsd:simpleType>
							</xsd:element>
							<xsd:element name="dateTime" type="xsd:dateTime">
								<xsd:annotation>
									<xsd:documentation>The receipt date of the Customs notification or status change by PCS.</xsd:documentation>
								</xsd:annotation>
							</xsd:element>
						</xsd:sequence>
					</xsd:complexType>
				</xsd:element>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:element name="StandardBusinessDocumentHeader" type="StandardBusinessDocumentHeader">
		<xsd:annotation>
			<xsd:documentation>start header information</xsd:documentation>
		</xsd:annotation>
	</xsd:element>
	<xsd:complexType name="StandardBusinessDocumentHeader">
		<xsd:sequence>
			<xsd:element name="HeaderVersion" fixed="2.2">
				<xsd:annotation>
					<xsd:documentation>Header Version 2.2</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="Sender" type="Partner">
				<xsd:annotation>
					<xsd:documentation>identifier is fixed value = NLRTMPCS</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="Receiver" type="Partner">
				<xsd:annotation>
					<xsd:documentation>ID given by Portbase to identify the company</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="DocumentIdentification" type="DocumentIdentification"/>
			<xsd:element name="Manifest" type="Manifest" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>For future use</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="BusinessScope" type="BusinessScope" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>used for test</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="Partner">
		<xsd:sequence>
			<xsd:element name="Identifier" type="PartnerIdentification">
				<xsd:annotation>
					<xsd:documentation>Descriptor with information to identify the sending party.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="ContactInformation" type="ContactInformation" minOccurs="0" maxOccurs="unbounded">
				<xsd:annotation>
					<xsd:documentation>Information about the contact for this document</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="PartnerIdentification">
		<xsd:simpleContent>
			<xsd:extension base="xsd:string">
				<xsd:attribute name="Authority" fixed="Portbase" use="required">
					<xsd:simpleType>
						<xsd:restriction base="xsd:string">
							<xsd:maxLength value="35"/>
						</xsd:restriction>
					</xsd:simpleType>
				</xsd:attribute>
			</xsd:extension>
		</xsd:simpleContent>
	</xsd:complexType>
	<xsd:complexType name="ContactInformation" abstract="false">
		<xsd:sequence>
			<xsd:element name="Contact" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>standard value is Service Desk</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="35"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="EmailAddress" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>Standaard e-mail address form our Portbase Servicedesk</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="50"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="FaxNumber" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>Standard fax number from our ServiceDesk</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="35"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="TelephoneNumber" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>Standard phone number from our ServiceDesk</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="35"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="ContactTypeIdentifier" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>Role of the contact in this business process</xsd:documentation>
					<xsd:documentation>Not Used</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="35"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="DocumentIdentification">
		<xsd:sequence>
			<xsd:element name="Standard" type="xsd:string" fixed="standardBusinessDocument.xsd"/>
			<xsd:element name="TypeVersion" default="1.0">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="35"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="InstanceIdentifier">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="40"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="Type" fixed="Export shipment status message (out)" type="xsd:string">
			</xsd:element>
			<xsd:element name="MultipleType" type="xsd:boolean" default="0" minOccurs="0"/>
			<xsd:element name="CreationDateAndTime" type="xsd:dateTime">
				<xsd:annotation>
					<xsd:documentation>Descriptor which contains date and time of SBDH/document creation.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="Manifest">
		<xsd:sequence>
			<xsd:element name="NumberOfItems" type="xsd:integer"/>
			<xsd:element name="ManifestItem" type="ManifestItem" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="ManifestItem">
		<xsd:sequence>
			<xsd:element name="MimeTypeQualifierCode" type="MimeTypeQualifier"/>
			<xsd:element name="UniformResourceIdentifier" type="xsd:anyURI"/>
			<xsd:element name="Description" type="xsd:string" minOccurs="0"/>
			<xsd:element name="LanguageCode" type="Language" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:simpleType name="MimeTypeQualifier">
		<xsd:annotation>
			<xsd:documentation>The MIME type as defined by IANA. Please refer to http://www.iana.org/assignments/media-types/ for a list of types.</xsd:documentation>
		</xsd:annotation>
		<xsd:restriction base="xsd:string"/>
	</xsd:simpleType>
	<xsd:simpleType name="Language">
		<xsd:annotation>
			<xsd:documentation>ISO 639-2; 1998 representation of Language name. Refer to http://www.loc.gov/standards/iso639-2/iso639jac.html to get the latest version of the standard.</xsd:documentation>
		</xsd:annotation>
		<xsd:restriction base="xsd:string"/>
	</xsd:simpleType>
	<xsd:complexType name="BusinessScope">
		<xsd:sequence>
			<xsd:element name="Scope" type="Scope" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="Scope">
		<xsd:sequence>
			<xsd:group ref="ScopeAttributes"/>
			<xsd:element ref="ScopeInformation" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:group name="ScopeAttributes">
		<xsd:sequence>
			<xsd:element name="Type">
				<xsd:annotation>
					<xsd:documentation>test indicator</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:enumeration value="test"/>
						<xsd:enumeration value="production"/>
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
			<xsd:element name="InstanceIdentifier" type="xsd:string"/>
			<xsd:element name="Identifier" type="xsd:string" minOccurs="0"/>
		</xsd:sequence>
	</xsd:group>
	<xsd:element name="ScopeInformation" type="xs:anyType" abstract="true"/>
	<xsd:element name="CorrelationInformation" type="CorrelationInformation" substitutionGroup="ScopeInformation"/>
	<xsd:complexType name="CorrelationInformation">
		<xsd:sequence>
			<xsd:element name="RequestingDocumentCreationDateTime" type="xsd:dateTime" minOccurs="0"/>
			<xsd:element name="RequestingDocumentInstanceIdentifier" type="xsd:string" minOccurs="0"/>
			<xsd:element name="ExpectedResponseDateTime" type="xsd:dateTime" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:element name="BusinessService" type="BusinessService" substitutionGroup="ScopeInformation"/>
	<xsd:complexType name="BusinessService">
		<xsd:sequence>
			<xsd:element name="BusinessServiceName" type="xsd:string" minOccurs="0"/>
			<xsd:element name="ServiceTransaction" type="ServiceTransaction" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="ServiceTransaction">
		<xsd:attribute name="TypeOf" type="TypeOfServiceTransaction" use="optional"/>
		<xsd:attribute name="IsNonRepudiationRequired" type="xsd:string"/>
		<xsd:attribute name="IsAuthenticationRequired" type="xsd:string"/>
		<xsd:attribute name="TimeToPerform" type="xsd:string"/>
		<xsd:attribute name="TimeToAcknowldedgeReceipt" type="xsd:string"/>
		<xsd:attribute name="TimeToAcknowldedgeAcceptance" type="xsd:string"/>
	</xsd:complexType>
	<xsd:simpleType name="TypeOfServiceTransaction">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="RequestingServiceTransaction"/>
			<xsd:enumeration value="RespondingServiceTransaction"/>
		</xsd:restriction>
	</xsd:simpleType>
	<xsd:element name="documentContent" type="documentContent"/>
	<xsd:complexType name="documentContent">
		<xsd:sequence>
			<xsd:element name="contentHeader" type="contentHeader"/>
			<xsd:element name="contentBody">
				<xsd:complexType>
					<xsd:sequence>
						<xsd:element ref="exportShipment">
							<xsd:annotation>
								<xsd:documentation>Start of the Customs document.</xsd:documentation>
							</xsd:annotation>
						</xsd:element>
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
		</xsd:sequence>
		<xsd:attribute name="totalNumberOfContentBodies" type="xsd:integer" use="optional"/>
	</xsd:complexType>
	<xsd:complexType name="contentHeader">
		<xsd:sequence>
			<xsd:element name="contentType" fixed="Export shipment status" type="xsd:string">
			</xsd:element>
			<xsd:element name="contentVersion" type="xsd:string"/>
			<xsd:element name="contentStandard" type="xsd:string" fixed="ECS_exportshipmentstatus.xsd">
				<xsd:annotation>
					<xsd:documentation>link to the XSD scheme of the content on the Port infolink site.</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
			<xsd:element name="contentReference" type="xsd:string"/>
			<xsd:element name="contentAction" fixed="original">
			</xsd:element>
			<xsd:element name="previousContentReference" type="xsd:string" minOccurs="0">
				<xsd:annotation>
					<xsd:documentation>only used when action not equal to original</xsd:documentation>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
</xsd:schema>